
package com.kanjian.music.adapter;

import java.util.ArrayList;

import com.kanjian.music.fragment.BannerFragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

public class BannerPagerAdapter extends FragmentPagerAdapter {

    ArrayList<BannerFragment> mFragmentList;

    public BannerPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    public BannerPagerAdapter(FragmentManager fm, ArrayList<BannerFragment> list) {
        super(fm);
        this.mFragmentList = list;
    }

    public void setFragmentList(ArrayList<BannerFragment> mList) {
        this.mFragmentList = mList;
        this.notifyDataSetChanged();
    }

    @Override
    public void setPrimaryItem(ViewGroup container, int position, Object object) {
        super.setPrimaryItem(container, position, object);
    }

    @Override
    public Fragment getItem(int arg0) {
        return mFragmentList.get(arg0);
    }

    @Override
    public int getCount() {
        return mFragmentList == null? 0 : mFragmentList.size();
    }

}
